#include <unordered_map>
#include <cryptoTools/Common/Defines.h>
#include "OTOracleSender.h"
#include <cryptoTools/Common/Log.h>
#include <mutex>
#include <cryptoTools/Network/Channel.h>


using namespace osuCrypto;

namespace tests_libOTe
{
    OTOracleSender::OTOracleSender(const block& seed)
        :mPrng(seed)
    {
    }

    OTOracleSender::~OTOracleSender()
    {
    }




    void OTOracleSender::send(
        gsl::span<std::array<block, 2>> messages,
        PRNG& prng,
        Channel& chl)
    {
        block test = mPrng.get<block>();
        chl.asyncSendCopy((u8*)&test, sizeof(block));

        u64 doneIdx = 0;

        for (doneIdx = 0; doneIdx < u64(messages.size()); ++doneIdx)
        {
            messages[doneIdx][0] = mPrng.get<block>();
            messages[doneIdx][1] = mPrng.get<block>();

            //std::cout << " idx  " << doneIdx << "   " << messages[doneIdx][0] << "   " << messages[doneIdx][1] << std::endl;

        }
    }

}